package com.ma.math;

public class FixedInt   {
	public int i;


	public float getScalar() {
		return (float)this.i * 0.001f;
	}
	

	public FixedInt(int i)
	{
		this.i = i;
	}

	

	public FixedInt(float f)
	{
		this.i = (int)Math.round((double)(f * 1000f));
	}
  
	
    @Override
    public int hashCode() {
    	return super.hashCode();
    }


	public static FixedInt Min(FixedInt a, FixedInt b)
	{
		return new FixedInt(Math.min(a.i, b.i));
	}

	public static FixedInt Max(FixedInt a, FixedInt b)
	{
		return new FixedInt(Math.max(a.i, b.i));
	}
    
	@Override
	public String toString() {
		return new Float(getScalar()).toString();
	}
	
	
	public static  FixedInt toFixedInt(float f)
	{
		return new FixedInt((int)Math.round((double)(f * 1000f)));
	}
    
	public static  FixedInt toFixedInt(int f)
	{
		return new FixedInt(f);
	}
	
	public static float toFloat(FixedInt ob)
	{
		return (float)ob.i * 0.001f;
	}
   


    public static long toLong(FixedInt ob)
    {
    	return (long)ob.i;
    }


    public static FixedInt addition(FixedInt a,FixedInt b)
    {
    	return new FixedInt(a.i + b.i);
    }
    
	
    public static FixedInt subtraction(FixedInt a,FixedInt b)
    {
    	return new FixedInt(a.i - b.i);
    }

	public static boolean issame(FixedInt a, FixedInt b)
	{
		return a.i == b.i;
	}
	
	
}
